<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>伪元素使用场景：字体图标应用</title>
    <style>
        @font-face {
  font-family: 'icomoon';
  src:  url('fonts/icomoon.eot?qrbotk');
  src:  url('fonts/icomoon.eot?qrbotk#iefix') format('embedded-opentype'),
    url('fonts/icomoon.ttf?qrbotk') format('truetype'),
    url('fonts/icomoon.woff?qrbotk') format('woff'),
    url('fonts/icomoon.svg?qrbotk#icomoon') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}


        div {
            position: relative;
            width: 200px;
            height: 30px;
            border: 1px solid red;
            margin: 50px auto;
        }
        /* 这种字体图标放到盒子的某个位置一般是用定位来做 */
        div::before {
            font-family: 'icomoon';
            position: absolute;
            top: 8px;
            right: 30px;
            /* 伪元素选择器必须要有content属性否则无效 */
            content: '';
            font-size: 13px;
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>